"""
__author__ = 'berlinyoung'
@File   :contact_page.py
@Date   :2021/9/4 13:20
-*- coding: utf-8 -*-
"""
from time import sleep

from selenium.webdriver.common.by import By

from test_web.training_step3.po.add_member_page import AddMemberPage
from test_web.training_step3.po.base_page import BasePage


class ContactPage(BasePage):
    # 添加baseurl,可以支持测试用例灵活配置起始页
    # basepage 完全和业务逻辑解耦
    _base_url = "https://work.weixin.qq.com/wework_admin/frame#contacts"
    _member_name_list = (By.CSS_SELECTOR,".member_colRight_memberTable_td:nth-child(2)")

    def goto_add_member(self):
        """
        跳转到添加成员页面
        :return:
        """
        return AddMemberPage(self.driver)

    def get_member_list(self):
        """
        获取成员列表
        :return:返回用于断言的成员列表信息
        """
        ele = self.driver.find_elements(*self._member_name_list)
        # 通过列表推导式获取列表数据信息
        name_list = [i.text for i in ele]
        print(name_list)
        return name_list